import requests from './request.js';

export const PageCart = (currentPage,pageSize) =>{
    return requests({
        url:'/cart/getCartPage',
        params:{
            currentPage,
            pageSize
        },
        method:'get'
    })
    
}


export const deleteCart = (cartId) =>{
    console.log(cartId);
    return requests({
        url:'/cart/cartId',
        params:{
            cartId
        },
        method:'delete'
    })
}

export const addUser = (data) =>{
    return requests({
        url:'/user/addUser',
        params:{
            user: data
        },
        method:'post'
    })
}

export const getUser=(data)=>{
    return requests({
        url:'/cart/queryCart',
        data,
        method:'get'
    })
}

export const getcategorylist = () => {
    return request({
        url: 'category/getAllcategory',
        method:"get"
    })
}

export const selectfoodlist = () => {
    return request({
        url: 'foodlist/selectfoodlisttop10',
        method:"get"
    })
}

export const selectbloglist = () => {
    return request({
        url: 'blog/getallblog',
        method:"get"
    })
}
export const selectfoodlistByCategory = (current,size,categorytype) => {
    return request({
        url: 'foodlist/selectfoodlistByCategory',
        method:"get",
        params:{
            current:current,
            size:size,
            categorytype:categorytype
        }
    })
}

export const selectfoodlistDesc = (current,size) => {
    return request({
        url: 'foodlist/selectfoodlistDesc',
        method:"get",
        params:{
            current:current,
            size:size
        }
    })
}
export const selectfoodlistAsc = (current,size) => {
    return request({
        url: 'foodlist/selectfoodlistAsc',
        method:"get",
        params:{
            current:current,
            size:size
        }
    })
}
export const selectfoodlistByName = (name) => {
    return request({
        url: 'foodlist/selectfoodlistByName',
        method:"get",
        params:{
            name:name
        }
    })
}
export const selectOrderlist = () => {
    return request({
        url: 'order/selectOrderlist',
        method:"get"
    })
}


export const login = (uname,password) => {
    return request({
        url: 'user/login',
        method:"get",
        params:{
            uname:uname,
            password:password
        }
    })
}

export const insertcontact = (contactName,contactEmail,contactPhone,contactTitle,contactMessage) => {
    return request({
        url: 'contact/insertcontact',
        method:"get",
        params:{
            contactName:contactName,
            contactEmail:contactEmail,
            contactPhone:contactPhone,
            contactTitle:contactTitle,  
            contactMessage:contactMessage
        }
    })
}
export const getbloglist = (pageNum,pageSize) => {
    return request({
        url: 'blog/page',
        method:"get",
        params:{
            pageNum:pageNum,
            pageSize:pageSize
        }
    })
}

import request from './request.js'